<?php
echo "Svečių knyga<br>";

//default formi vivod dannix stolbikom
if($_GET['detail']==null){ //naujienos vivod
echo "<br>";

echo "
<table width='600' border='1' cellspacing='0' cellpadding='0' style='border-collapse:collapse;'>
  <tr>
    <td width='26'>Nr.</td>
    <td width='368'>Atsiliepimo pavadinimas</td>
    <td width='97'>Atsiliepimo autorius</td>
    <td width='99'>Veiksmai</td>
  </tr>";
$result=mysql_query("select * from questbokas"); //meniu isvedimas
$i=0;
while ($row = mysql_fetch_assoc($result)) {
$i++;
echo "<tr>
    <td>$i</td>
    <td>$row[titlas]</td>
    <td>$row[author]</td>
    <td><a href='index.php?module=sveciai&review=$row[id]&detail=1'>peržiūra</a> &nbsp;&nbsp;&nbsp;<a href='index.php?module=sveciai&delete=$row[id]&detail=1'>trinti</a></td>
  </tr>";
}
echo "</table>";
}


//questbook delete
if($_GET['detail']==1 && is_numeric($_GET['delete']) ){
$obj=new queris();
$obj->deletequestbook($_GET['delete']);
echo "<script>window.location='index.php?module=sveciai';</script>";
}

//questbook review
if($_GET['detail']==1 && is_numeric($_GET['review']) ){
$result=mysql_query("select * from questbokas where id='$_GET[review]'"); //meniu isvedimas
$row = mysql_fetch_assoc($result);
echo "<br><a href='index.php?module=sveciai'>Grįžti atgal</a><br>";
echo "<br>Atsiliepimo pavadinimas:$row[titlas]<br>";
echo "Atsiliepimo autorius:$row[author]<br><br>";
echo "Atsiliepimas:<br>$row[text]";
echo "<br>";

}

?>